//
//  YWShowRulesTableViewController.m
//  maintain
//
//  Created by Kyo on 16/5/13.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWShowRulesTableViewController.h"
#import "UIView+Extension.h"
#import "YWMissionRuleResult.h"
#import "YWShowRuleCell.h"

@interface YWShowRulesTableViewController ()

@end

@implementation YWShowRulesTableViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
//    self.view.height = 0;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.rulesArray count];
}

- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
    YWShowRuleCell *cell = [YWShowRuleCell cellWithTableView:tableView];
    YWMissionRuleResult* missionRuleResult = [self.rulesArray objectAtIndex:indexPath.row];
    cell.content = [NSString stringWithFormat:@"%ld.%@", (long)(indexPath.row + 1), missionRuleResult.content];
    return cell;
}
#pragma mark Table view delegate

- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
    YWMissionRuleResult* missionRuleResult = [self.rulesArray objectAtIndex:indexPath.row];
    NSString *content = [NSString stringWithFormat:@"%ld.%@", (long)(indexPath.row + 1), missionRuleResult.content];
    CGFloat rowH = [YWShowRuleCell cellHeightOfContent:content];
    return rowH;
}

@end
